/*     */ package eos.moe.dragoncore;
/*     */ 
/*     */ import com.google.common.collect.ImmutableList;
/*     */ import java.awt.Point;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Collection;
/*     */ import java.util.HashSet;
/*     */ import java.util.List;
/*     */ import java.util.Locale;
/*     */ import java.util.Map;
/*     */ import java.util.Set;
/*     */ import java.util.concurrent.ConcurrentHashMap;
/*     */ import mezz.jei.gui.recipes.RecipesGui;
/*     */ import net.minecraft.client.Minecraft;
/*     */ import net.minecraft.client.gui.GuiChat;
/*     */ import net.minecraft.client.gui.GuiScreen;
/*     */ import net.minecraft.client.gui.ScaledResolution;
/*     */ import net.minecraft.client.gui.inventory.GuiChest;
/*     */ import net.minecraft.client.gui.inventory.GuiContainer;
/*     */ import net.minecraft.client.gui.inventory.GuiInventory;
/*     */ import net.minecraft.client.resources.I18n;
/*     */ import net.minecraft.inventory.Container;
/*     */ import net.minecraft.inventory.IInventory;
/*     */ import net.minecraft.potion.Potion;
/*     */ import net.minecraft.potion.PotionEffect;
/*     */ import net.minecraft.util.text.ChatType;
/*     */ import net.minecraft.util.text.ITextComponent;
/*     */ import net.minecraft.util.text.TextComponentString;
/*     */ import net.minecraftforge.client.event.ClientChatReceivedEvent;
/*     */ import net.minecraftforge.client.event.GuiOpenEvent;
/*     */ import net.minecraftforge.client.event.GuiScreenEvent;
/*     */ import net.minecraftforge.client.event.RenderGameOverlayEvent;
/*     */ import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
/*     */ import net.minecraftforge.fml.common.eventhandler.EventPriority;
/*     */ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
/*     */ import net.minecraftforge.fml.common.gameevent.InputEvent;
/*     */ import net.minecraftforge.fml.common.gameevent.TickEvent;
/*     */ import net.minecraftforge.fml.relauncher.ReflectionHelper;
/*     */ import org.lwjgl.input.Keyboard;
/*     */ import org.yaml.snakeyamla.configuration.file.YamlConfiguration;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ @EventBusSubscriber(modid = "dragoncore")
/*     */ public class pl
/*     */ {
/*  52 */   public static final ConcurrentHashMap<String, vh> i = new ConcurrentHashMap<>();
/*  53 */   public static final Minecraft w = Minecraft.func_71410_x();
/*     */   
/*  55 */   private static final Set<String> q = new HashSet<>();
/*     */   
/*  57 */   public static ScaledResolution g = new ScaledResolution(w);
/*     */ 
/*     */   
/*     */   @SubscribeEvent
/*     */   public static void v(TickEvent.RenderTickEvent a) {
/*  62 */     if (a.phase == TickEvent.Phase.START) {
/*  63 */       Point point = sk.v();
/*  64 */       sk.w = point.x;
/*  65 */       sk.q = point.y;
/*     */     } 
/*     */   }
/*     */   
/*     */   @SubscribeEvent
/*     */   public static void v(TickEvent.ClientTickEvent a) {
/*  71 */     g = new ScaledResolution(w);
/*  72 */     if (a.phase == TickEvent.Phase.END)
/*     */       return; 
/*  74 */     if (w.field_71439_g == null)
/*     */       return; 
/*  76 */     dh.d.v("tickEnd", new o[0]);
/*     */ 
/*     */     
/*  79 */     Map<String, o> map = qp.z.v();
/*  80 */     map.entrySet().removeIf(a -> ((String)a.getKey()).startsWith("buff_"));
/*     */     
/*  82 */     int i = 1;
/*  83 */     for (PotionEffect potionEffect : w.field_71439_g.func_70651_bq()) {
/*  84 */       Potion potion = potionEffect.func_188419_a();
/*  85 */       String str1 = potionEffect.func_76453_d();
/*  86 */       String str2 = I18n.func_135052_a(potion.func_76393_a(), new Object[0]);
/*  87 */       if (potionEffect.func_76458_c() == 1) {
/*  88 */         str2 = str2 + " " + I18n.func_135052_a("enchantment.level.2", new Object[0]);
/*  89 */       } else if (potionEffect.func_76458_c() == 2) {
/*  90 */         str2 = str2 + " " + I18n.func_135052_a("enchantment.level.3", new Object[0]);
/*  91 */       } else if (potionEffect.func_76458_c() == 3) {
/*  92 */         str2 = str2 + " " + I18n.func_135052_a("enchantment.level.4", new Object[0]);
/*     */       } 
/*     */       
/*  95 */       String str3 = Potion.func_188410_a(potionEffect, 1.0F);
/*  96 */       int j = (int)(potionEffect.func_76459_b() / 20.0F);
/*     */       
/*  98 */       om om = new om();
/*  99 */       om.v().put("name", ah.v(str1));
/* 100 */       om.v().put("displayname", ah.v(str2));
/* 101 */       om.v().put("duration", ah.v(str3));
/* 102 */       om.v().put("second", xk.v(Integer.valueOf(j)));
/* 103 */       om.v().put("level", xk.v(Integer.valueOf(potionEffect.func_76458_c())));
/* 104 */       map.put("buff_" + i, om);
/* 105 */       i++;
/*     */     } 
/*     */   }
/*     */ 
/*     */   
/*     */   @SubscribeEvent
/*     */   public static void v(ClientChatReceivedEvent a) {
/* 112 */     if (a.getType() == ChatType.GAME_INFO)
/*     */       return; 
/* 114 */     String str = a.getMessage().func_150254_d();
/* 115 */     if (!str.isEmpty()) {
/* 116 */       boolean bool = false;
/*     */       
/* 118 */       for (vh vh : dh.d.v()) {
/* 119 */         vh.u = a.getMessage();
/* 120 */         vh.j = a.getMessage();
/* 121 */         bool = (bool || vh.runGuiAction(wn.n));
/* 122 */         vh.u = (ITextComponent)new TextComponentString("");
/*     */       } 
/* 124 */       if (bool) {
/* 125 */         a.setCanceled(true);
/*     */       }
/*     */     } 
/*     */   }
/*     */   
/*     */   @SubscribeEvent
/*     */   public static void v(GuiScreenEvent.DrawScreenEvent.Post a) {
/* 132 */     if ((Minecraft.func_71410_x()).field_71439_g == null)
/*     */       return; 
/* 134 */     for (int i = 0; i < 5; i++) {
/* 135 */       for (Map.Entry<String, vh> entry : i.entrySet()) {
/* 136 */         if (q.contains(entry.getKey()) || ((vh)entry.getValue()).y != i) {
/*     */           continue;
/*     */         }
/* 139 */         if (((vh)entry.getValue()).m.equalsIgnoreCase("hud_post")) {
/* 140 */           ((vh)entry.getValue()).func_73863_a(a.getMouseX(), a.getMouseY(), w.func_193989_ak());
/*     */         }
/*     */       } 
/*     */     } 
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   @SubscribeEvent
/*     */   public static void v(RenderGameOverlayEvent.Pre a) {
/* 151 */     if (a.getType() == RenderGameOverlayEvent.ElementType.ALL) {
/* 152 */       q.clear();
/* 153 */       Point point = new Point(sk.w, sk.q);
/*     */       
/* 155 */       for (vh vh : i.values()) {
/* 156 */         q.addAll(vh.ea);
/*     */       }
/*     */       
/* 159 */       if (w.field_71462_r instanceof vh) {
/* 160 */         q.addAll(((vh)w.field_71462_r).ea);
/*     */       }
/*     */ 
/*     */       
/* 164 */       if (!(w.field_71462_r instanceof GuiChat) && (!(w.field_71462_r instanceof vh) || !((vh)w.field_71462_r).c))
/*     */       {
/* 166 */         point.x = -9999;
/*     */       }
/*     */       
/* 169 */       for (int i = 0; i < 5; i++) {
/* 170 */         for (Map.Entry<String, vh> entry : i.entrySet()) {
/*     */           
/* 172 */           if (q.contains(entry.getKey()) || ((vh)entry.getValue()).y != i) {
/*     */             continue;
/*     */           }
/* 175 */           String str = ((vh)entry.getValue()).m;
/*     */ 
/*     */           
/* 178 */           if (!str.equalsIgnoreCase("hud_post") || w.field_71462_r == null) {
/* 179 */             ((vh)entry.getValue()).func_73863_a(point.x, point.y, w.func_193989_ak());
/*     */           }
/*     */         } 
/*     */       } 
/* 183 */     } else if (q.contains(a.getType().name())) {
/* 184 */       a.setCanceled(true);
/*     */     } 
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   @SubscribeEvent
/*     */   public static void v(InputEvent.KeyInputEvent a) {
/* 196 */     if ((Minecraft.func_71410_x()).field_71462_r != null) {
/*     */       return;
/*     */     }
/* 199 */     if (Keyboard.getEventKeyState()) {
/* 200 */       String str = Keyboard.getKeyName(Keyboard.getEventKey());
/* 201 */       for (vh vh : i.values()) {
/* 202 */         vh.ka = str;
/* 203 */         vh.runGuiAction(wn.x);
/* 204 */         vh.ka = "";
/*     */       } 
/*     */     } else {
/* 207 */       String str = Keyboard.getKeyName(Keyboard.getEventKey());
/* 208 */       for (vh vh : i.values()) {
/* 209 */         vh.ka = str;
/* 210 */         vh.runGuiAction(wn.a);
/* 211 */         vh.ka = "";
/*     */       } 
/*     */     } 
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   @SubscribeEvent(priority = EventPriority.LOW)
/*     */   public static void v(GuiOpenEvent a) {
/* 221 */     Minecraft minecraft = Minecraft.func_71410_x();
/* 222 */     if (a.getGui() != null) {
/*     */       
/* 224 */       if (a.getGui().getClass().getSimpleName().equals("RecipesGui")) {
/*     */         
/* 226 */         RecipesGui recipesGui = (RecipesGui)a.getGui();
/*     */         
/* 228 */         if (recipesGui.getParentScreen() instanceof vh) {
/* 229 */           ((vh)recipesGui.getParentScreen()).ignoreNextClose();
/*     */         }
/*     */         return;
/*     */       } 
/* 233 */       if (a.getGui() instanceof vh) {
/*     */         return;
/*     */       }
/*     */       
/* 237 */       String str = null;
/* 238 */       Container container = (minecraft.field_71439_g == null) ? null : (Minecraft.func_71410_x()).field_71439_g.field_71069_bz;
/*     */       
/* 240 */       if (a.getGui() instanceof GuiChat && !(a.getGui() instanceof net.minecraft.client.gui.GuiSleepMP)) {
/* 241 */         if (nm.i && a.getGui().getClass() == GuiChat.class) {
/*     */           return;
/*     */         }
/* 244 */         GuiChat guiChat = (GuiChat)a.getGui();
/* 245 */         qp.z.v("guichatopen", new ah(guiChat.field_146409_v));
/* 246 */         Minecraft.func_71410_x().func_152344_a(() -> {
/*     */               for (vh a : i.values()) {
/*     */                 a.runGuiAction(wn.b);
/*     */               }
/*     */             });
/*     */       } 
/* 252 */       if (a.getGui().getClass() == GuiInventory.class) {
/* 253 */         if (!w.field_71442_b.func_78758_h())
/* 254 */           str = "GuiInventory"; 
/* 255 */         container = ((GuiInventory)a.getGui()).field_147002_h;
/* 256 */       } else if (a.getGui() instanceof GuiChest) {
/* 257 */         IInventory iInventory = (IInventory)ReflectionHelper.getPrivateValue(GuiChest.class, a.getGui(), new String[] { "field_147015_w", "lowerChestInventory" });
/* 258 */         str = (iInventory != null && iInventory.func_145748_c_() != null) ? iInventory.func_145748_c_().func_150260_c() : null;
/* 259 */         container = ((GuiChest)a.getGui()).field_147002_h;
/*     */       } else {
/* 261 */         if (a.getGui() instanceof GuiContainer) {
/* 262 */           container = ((GuiContainer)a.getGui()).field_147002_h;
/*     */         }
/* 264 */         str = a.getGui().getClass().getSimpleName();
/*     */       } 
/* 266 */       if (str != null && container != null && !str.isEmpty()) {
/* 267 */         fj<String, YamlConfiguration> fj = v(str);
/* 268 */         System.out.println("DragonCore GuiOpen->" + str);
/* 269 */         if (fj != null) {
/* 270 */           System.out.println("  - match success");
/* 271 */           vh vh = new vh(fj.z(), fj.v(), dh.d.h(), container, vh.eos/moe/dragoncore/ng.z);
/* 272 */           vh.setOriginalName(str);
/* 273 */           vh.setOriginalGui(a.getGui());
/* 274 */           vh.open();
/* 275 */           a.setGui((GuiScreen)vh);
/*     */         } 
/*     */       } 
/*     */     } 
/*     */   }
/*     */ 
/*     */   
/*     */   public static void z(String a, YamlConfiguration yamlConfiguration) {
/* 283 */     vh vh = new vh(a, yamlConfiguration, dh.d.h(), (Minecraft.func_71410_x()).field_71439_g.field_71069_bz, vh.eos/moe/dragoncore/ng.z);
/* 284 */     vh.open();
/* 285 */     Minecraft.func_71410_x().func_147108_a((GuiScreen)vh);
/*     */   }
/*     */   
/*     */   public static void v(String a, YamlConfiguration yamlConfiguration) {
/* 289 */     vh vh1 = i.remove(a);
/* 290 */     if (vh1 != null) {
/* 291 */       vh1.func_146281_b();
/*     */     }
/* 293 */     vh vh2 = new vh(a, yamlConfiguration, dh.d.h(), (Minecraft.func_71410_x()).field_71439_g.field_71069_bz, vh.eos/moe/dragoncore/ng.i);
/* 294 */     vh2.initGui_();
/* 295 */     vh2.open();
/* 296 */     i.put(a, vh2);
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public static void h() {
/* 302 */     for (Map.Entry<String, YamlConfiguration> a : dh.d.h().entrySet()) {
/* 303 */       String str = ((YamlConfiguration)a.getValue()).getString("match");
/* 304 */       if (str == null)
/*     */         continue; 
/* 306 */       if (str.toLowerCase(Locale.ROOT).equalsIgnoreCase("hud") || str
/* 307 */         .toLowerCase(Locale.ROOT).equalsIgnoreCase("hud_post")) {
/* 308 */         v((String)a.getKey(), (YamlConfiguration)a.getValue());
/*     */       }
/*     */     } 
/*     */   }
/*     */ 
/*     */   
/*     */   public static void z() {
/* 315 */     Collection a = new ArrayList(i.values());
/* 316 */     i.clear();
/* 317 */     for (vh vh : a) {
/* 318 */       vh.func_146281_b();
/*     */     }
/*     */   }
/*     */   
/*     */   public static void v(String a) {
/* 323 */     vh vh = i.remove(a);
/* 324 */     if (vh != null) {
/* 325 */       vh.func_146281_b();
/*     */     }
/*     */   }
/*     */ 
/*     */   
/*     */   public static fj<String, YamlConfiguration> v(String a) {
/* 331 */     for (Map.Entry<String, YamlConfiguration> entry : dh.d.h().entrySet()) {
/* 332 */       ImmutableList immutableList; YamlConfiguration yamlConfiguration = (YamlConfiguration)entry.getValue();
/*     */       
/* 334 */       List list = null;
/* 335 */       if (yamlConfiguration.isList("match")) {
/* 336 */         list = yamlConfiguration.getStringList("match");
/*     */       } else {
/* 338 */         String str = yamlConfiguration.getString("match");
/* 339 */         if (str != null && !str.isEmpty()) {
/* 340 */           immutableList = ImmutableList.of(str);
/*     */         }
/*     */       } 
/* 343 */       if (immutableList == null)
/*     */         continue; 
/* 345 */       for (String str : immutableList) {
/* 346 */         if (str != null && a != null && (a.equals(str) || a.matches(str))) {
/* 347 */           return fj.v((String)entry.getKey(), (YamlConfiguration)entry.getValue());
/*     */         }
/*     */       } 
/*     */     } 
/*     */     
/* 352 */     return null;
/*     */   }
/*     */ }


/* Location:              D:\fanbian\[D][龙之核心]DragonCore-2.6.0.3.jar!\eos\moe\dragoncore\pl.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */